package cn.leaf.decorator;

/**
 *
 * desc: 装饰者模式测试
 * Spring框架中的应用：
 * 类名中含有 Wrapper， 另一种是类名中含有Decorator
 * ------------------------------------------
 * Jdk中的应用：
 * InputStream的具体装饰类BufferedInputStream、CheckedInputStream
 * -----------------------------------------------------------
 * @author twinkle-leaf
 * @version v1.0.0
 * slogan: There are no two identical leaves in the world.🍃
 *
 */
public class DecoratorTest {


    public static void main(String[] args) {

        // 只会唱歌的歌手
        SimpleSinger simpleSinger = new SimpleSinger();

        // 还会跳舞的歌手
        DanceSingerDecorator danceSingerDecorator = new DanceSingerDecorator(simpleSinger);

        // 还会rap的歌手
        RapSingerDecorator rapSinger = new RapSingerDecorator(danceSingerDecorator);

        // 还会打篮球的歌手
        BasketballSinger basketballSinger = new BasketballSinger(rapSinger);
        basketballSinger.perform();
    }
}
